package com.project.stream_producer.demo4.controller;

import com.project.stream_producer.demo4.service.MessageDemo4Producer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SendDemo4Controller {
    @Autowired
    MessageDemo4Producer messageDemo4Producer;
    @GetMapping("demo4/sendMsg")
    public void sendMsg(){
        for (int i = 0; i < 10; i++) {
            messageDemo4Producer.send(i,3);
//            if(i>5) {
//                System.out.println(messageDemo4Producer.send(i,1));
//            }else{
//                System.out.println(messageDemo4Producer.send(i,2));
//            }
        }
    }
}
